import request from "@/utils/request";

/**
 * @function 获取菜单列表
 * @param {string} type 菜单类型 0菜单，1按钮，不传全部
 * **/
export const menuListApi = (params) => {
  return request.get('/sys/menu/list', {params})
}

/**
 * @function 获取菜单详情
 * @param {string} id
 * **/
export const menuDetailApi = (id) => {
  return request.get(`/sys/menu/${id}`)
}

/**
 * @function 新增菜单
 * @param {object} data
 * **/
export const createMenuApi = (data) => {
  return request.post('/sys/menu', data)
}

/**
 * @function 修改菜单或按钮
 * @param {object} data
 * **/
export const updataMenuApi = (data) => {
  return request.put('/sys/menu', data)
}

/**
 * @function 删除菜单或按钮
 * @param {string} id
 * **/
export const deleteMenuApi = (id) => {
  return request.delete(`/sys/menu/${id}`)
}

/**
 * @function 获取角色菜单权限列表
 * **/
export const menuSelectApi = () => {
  return request.get('/sys/menu/select')
}